﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using UIT.ScrumTool.Client.ControlService;

namespace UIT.ScrumTool.Client.Controller
{
    public class DocumentCtrl
    {
        #region Thuoc Tinh
        //lay kenh Document
        private static ControlService.DocumentServiceClient documentServiceClient = new ControlService.DocumentServiceClient();
        #endregion

        public static List<DocumentDto> DocumentGetByAll()
        {
            try
            {
                return documentServiceClient.DocumentGetByAll().ToList();
            }
            catch (Exception)
            {
                return null;
            }
        }

        public static List<DocumentDto> DocumentGetByProjectId(int projectId)
        {
            try
            {
                return documentServiceClient.DocumentGetByProjectId(projectId).ToList();
            }
            catch (Exception)
            {
                return null;
            }
        }

        public static DocumentDto DocumentGetById(int id)
        {
            try
            {
                return documentServiceClient.DocumentGetById(id);
            }
            catch (Exception)
            {
                return null;
            }
        }

        public static List<DocumentDto> DocumentGetByTop(string top, string where, string order)
        {
            try
            {
                return documentServiceClient.DocumentGetByTop(top, where, order).ToList();
            }
            catch (Exception)
            {
                return null;
            }
        }

        public static bool DocumentInsert(DocumentDto document)
        {
            try
            {
                return documentServiceClient.DocumentInsert(document);
            }
            catch (Exception)
            {
                return false;
            }
        }

        public static bool DocumentUpdate(DocumentDto document)
        {
            try
            {
                return documentServiceClient.DocumentUpdate(document);
            }
            catch (Exception)
            {
                return false;
            }
        }

        public static bool DocumentDelete(int id)
        {
            try
            {
                return documentServiceClient.DocumentDelete(id);
            }
            catch (Exception)
            {
                return false;
            }
        }

        public static bool DocumentDeleteProjectId(int projectId)
        {
            try
            {
                return documentServiceClient.DocumentDeleteProjectId(projectId);
            }
            catch (Exception)
            {
                return false;
            }
        }
    }
}
